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
Post a Comment