S
somenath
Hi All,
Can any body explain why the bellow mention crashes wwhen I try to
execute.
#include<stdio.h>
#include<stdlib.h>
void convert_cpp_string_to_int(char * cpp_string,int *integer_valueP);
int main(void )
{
char * s ="34567";
int x = 5;
int *iptrP=NULL;
convert_cpp_string_to_int(s,iptrP);
printf("INTEGER = =%d \n", *iptrP);
return 0;
}
void convert_cpp_string_to_int(char * cpp_string,int *integer_valueP)
{
*integer_valueP = atoi( cpp_string);
}
But If i modify my code as mention bellow it does not crash
#include<stdio.h>
#include<stdlib.h>
void convert_cpp_string_to_int(char * cpp_string,int *integer_valueP);
int main(void )
{
char * s ="34567";
int x = 5;
int *iptrP=&x;
convert_cpp_string_to_int(s,iptrP);
printf("INTEGER = =%d \n", *iptrP);
return 0;
}
void convert_cpp_string_to_int(char * cpp_string,int *integer_valueP)
{
*integer_valueP = atoi( cpp_string);
}
Regards,
Somenath
Can any body explain why the bellow mention crashes wwhen I try to
execute.
#include<stdio.h>
#include<stdlib.h>
void convert_cpp_string_to_int(char * cpp_string,int *integer_valueP);
int main(void )
{
char * s ="34567";
int x = 5;
int *iptrP=NULL;
convert_cpp_string_to_int(s,iptrP);
printf("INTEGER = =%d \n", *iptrP);
return 0;
}
void convert_cpp_string_to_int(char * cpp_string,int *integer_valueP)
{
*integer_valueP = atoi( cpp_string);
}
But If i modify my code as mention bellow it does not crash
#include<stdio.h>
#include<stdlib.h>
void convert_cpp_string_to_int(char * cpp_string,int *integer_valueP);
int main(void )
{
char * s ="34567";
int x = 5;
int *iptrP=&x;
convert_cpp_string_to_int(s,iptrP);
printf("INTEGER = =%d \n", *iptrP);
return 0;
}
void convert_cpp_string_to_int(char * cpp_string,int *integer_valueP)
{
*integer_valueP = atoi( cpp_string);
}
Regards,
Somenath