In this code, I am facing a problem that is whenever I try to enter the first
and last
name, it only prints the first
name in the file. But I want to print the last
name also. The space between the two words should not be removed. Instead first and last should be considered as one.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
FILE *fp = fopen("new.csv", "w");
char name[50];
printf("Enter your name: ");
scanf("%s", name);
fprintf(fp, "%s", name);
fclose(fp);
return 0;
}