|
|
Answers:
We can convert number to string using built in function itoa().
we can convert number to string using sprintf() function as shown below.
char result[100]; int num = 24; sprintf( result,"%d",num);
 Posted by: Ravikumar M
Contact Ravikumar M
even if we use printf with %s,the no is interpretted 4 string
 Posted by: varun
Contact varun
#include<stdlib.h> void main() { char s[10]; int a=4521; itoa(a,s,10); printf("%s",s); }
 Posted by: juned khan
Contact juned khan
#include <stdio.h> int main(void) { const char base[] = "filename"; char filename [ FILENAME_MAX ]; int number = 42; sprintf(filename, "%s%d", base, number); printf("filename = "%s"
", filename); return 0; } /* my output filename = "filename42" */#include <stdio.h> int main(void) { const char base[] = "filename"; char filename [ FILENAME_MAX ]; int number = 42; sprintf(filename, "%s%d", base, number); printf("filename = "%s"
", filename); return 0; } /* my output filename = "filename42" */
 Posted by: santosh kumar mallick
Contact santosh kumar mallick
If you have the better answer, then send it to us. We will display your answer after the approval.
   
|