Monday, July 27, 2009

I keep getting an error message when prograamming in c?

the message i get is 'const char*' to 'char' im trying to use a string array, im not sure what this means. im only a beginer so try and keep ur answers simple

I keep getting an error message when prograamming in c?
I think you have syntax error


check your declaration....


if you are using strings,then you cannot declar it with character (char). you should declar it as a string .








also check if have written #include%26lt;string%26gt; on the top of the program..


for example:





#include%26lt;stdio.h%26gt; //this is for printf ans scanf -as you should know-





#include%26lt;string%26gt; // this one is for the string cause you are using it.





the when you declare..use for example


string alpabet ; ((or any name that you declare))





good luck!!
Reply:What you need is a tutorial for C programming.





http://vergil.chemistry.gatech.edu/resou...
Reply:If you do not know the difference between a char* and char then you seriously need to learn more C before you attempt to play with strings.





Exactly what error are you getting? It all depends on what you declared and how you are modifying it. Remember that a string array is really an array of char *. You have to dereference those pointers before assigning values.
Reply:it would help to see the code where the error is occouring, but, it sounds like you are trying to pass a char pointer when only a char is required OR you are trying to pass a char when a char pointer is required.


No comments:

Post a Comment