Please help me to understand this. When I compile this code (save as test.c)

int main() 
char *targ = "xxxxxxxxxxxxxxxxxxx"; 
printf("%s", *targ); 

it shows this warning message

[Warning] deprecated conversion from string constant to 'char' [-Wwrite-strings]

And when I run this code it show me this message

test.exe has stopped working

Why it shows the warning message?? Is it not a valid way to print string as printf("%s", *str); If it is not a valid way then why it is not valid??

asked 06 Dec '16, 07:35

mars's gravatar image


You may visit this link for better understanding your problem solution.

permanent link

answered 06 Dec '16, 15:36

csemominur23's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 06 Dec '16, 07:35

question was seen: 971 times

last updated: 06 Dec '16, 15:36