Quick actions

cmd+k|ctrl+k

Navigation

Languages

convert to a sting to long integer

Snippet info

Language

C

Visibility

public

Author

krishnakanth

Created

2023-01-19T15:32:29.913703Z

Updated

2023-01-19T15:32:29.913703Z

/*Exercise-3:
a). Write a C program to convert to a string to a long integer.*/
#include<stdio.h>
#include<stdlib.h>
main()
{
 int val;
 char strn1[] = "12546";
val = atoi(strn1);
 printf("String value = %s\n", strn1);
 printf("Integer value = %d\n", val);
char strn2[] = "sai";
 val = atoi(strn2);
 printf("String value = %s\n",strn2);
 printf("Integer value = %d\n", val);
}
INFO