sscanf in c

Solutions on MaxInterview for sscanf in c by the best coders in the world

showing results for - "sscanf in c"
Greta
01 Sep 2016
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4
5int main () {
6   int day, year;
7   char weekday[20], month[20], dtm[100];
8
9   strcpy( dtm, "Saturday March 25 1989" );
10   sscanf( dtm, "%s %s %d  %d", weekday, month, &day, &year );
11
12   printf("%s %d, %d = %s\n", month, day, year, weekday );
13    
14   return(0);
15}
Romy
16 May 2020
1ltoa() function in C language converts long data type to string data type.
2Syntax for ltoa() function is given below.
3
4------------------------------------------------------
5    
6    char *ltoa(long N, char *str, int base);
Assia
10 Feb 2019
1#include <stdio.h>
2
3int main () {
4   FILE *fp;
5
6   fp = fopen("file.txt", "w+");
7
8   fputs("This is c programming.", fp);
9   fputs("This is a system programming language.", fp);
10
11   fclose(fp);
12   
13   return(0);
14}
Courtney
23 Feb 2016
1March 25, 1989 = Saturday
2