Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

casting int2char

Status
Not open for further replies.

atferraz

Technical User
Aug 23, 2003
129
PT
Hello, need to cast a integer to char.
My real problem is this:

int i,k=0;
for(i=0;i<100;i++)
{
strcat(nome, k); // on BSD is an error: incompatible types in assignment
}

 
I'd say your real problem is you don't know a lot of what you are actually trying to do. Perhaps you could try to better describe what it is that you would like your program to do.

[To "cast a integer to char" it not the same as to "convert an integer value to its base-10 representation in text".]
 
strcat expects two strings, and you're providing a string and an int, hence the error.

As Dave said, you should specify what you're trying to do and I'd suggest a quick search on google or in this forum about that before asking: you will find a lot of answers and you will feel better.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top