Initialization of a variable in for loop in c language

radha gogia

radha gogia

@radha-BTDzli Oct 25, 2024
why the piece of code like

for(int i=0;i<19;i++)
{
printf("hello");
}

is an error,that is why in C,the variable can't be initialized within the for loop,while in other programming languages it is possible,so basically whats the reason behind it.

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform