c - How to use Goto function -


can use goto jump other functions? example

void x(){  printf("hello"); }  void y(){  printf("hi"); }  int main(){     /*assume var declared */   scanf("%d",&input);   if(input == 1) goto y();   else(input == 2) goto x(); } 

do not use goto, ever. ugly, old , obfuscates things unnecessarily.

int main() {     /*assume var declared */      scanf("%d",&input);     if(input == 1) {         y();     } else if (input == 2) {         x();     } }   

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -