#include<iostream>
#include<string.h>
using namespace std;
int main(){
char g1[] = "hello";
char g2[] = "12345678";
std::cout<<"g1 size Before -> "<<sizeof(g1)<<endl;
strcpy(g1, g2);
std::cout<<"g1 -> "<<g1<<endl;
std::cout<<"g1 size after-> "<<sizeof(g1)<<endl;
}
Thanks for the response. But why sizeof(g1) will not change ?
we are copying the contents of g2 array to g1 array. Size should change. Please mark me if I am wrong on strcpy function usage.
Great !!! Thanks a lot everyone for your responses. :)