How to convert string to long in C

1 Answer

0 votes
#include <stdio.h>
#include <stdlib.h> 
 
int main(void) {
    char s[] = "8493274";
    
    long l = strtol(s, NULL ,0);
    
    printf("%ld", l);
    
    return 0;
}
 
 
 
 
 
/*
run:
 
8493274
 
*/

 



answered Jun 20, 2021 by avibootz

Related questions

1 answer 115 views
115 views asked Jul 12, 2023 by avibootz
1 answer 151 views
1 answer 188 views
1 answer 296 views
296 views asked Jun 20, 2021 by avibootz
1 answer 108 views
...