Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is my code
C++
#include <stdio.h>
int main(){
char Name="Daniel";
printf("Hello My Name Is %s",Name);
}
:

This is my error:
warning: initialization makes integer from pointer without a cast [-Wint-conversion]|

What I have tried:

I have tried stackoverflow,I have also looked all over google but couldnt find the awnser.I also tried quora
Posted
Updated 1-Nov-22 1:03am

Rick is right but you need to add a
C++
return 0;
at the end of main function!!!

Visit some tutorial like Learn C to improve your coding skills.
 
Share this answer
 
As suggested by the others, it should be
#include <stdio.h>

int main()
{
  const char * name = "Daniel";
  printf("Hello my name is %s\n", name);
  return 0;
}
 
Share this answer
 
That needs to be a "char *".
C++
char * name = "Daniel";
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900