Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
If it is advisable to convert an Integer to a String in C, then you are able to do one of many following:
sprintf()
int sprintf(char *str, const char *format, [arg1, arg2, ... ]);
You are able to do one thing like this:
#embrace <stdio.h>
int major(void) {
int quantity;
char textual content[20];
printf("Enter a quantity: ");
scanf("%d", &quantity);
sprintf(textual content, "%d", quantity);
printf("nYou have entered: %s", textual content);
return 0;
}
itoa()
char* itoa(int num, char * buffer, int base)
You are able to do one thing like this:
#embrace <stdio.h>
#embrace <stdlib.h>
#embrace <string.h>
int major(void) {
int quantity,l;
char string[20];
printf("Enter a quantity: ");
scanf("%d", &quantity);
itoa(quantity,string,10);
printf("String worth = %sn", string);
return 0;
}