answersLogoWhite

0

What is the diff between return 0 and return 1 in c?

Updated: 8/20/2019
User Avatar

Wiki User

11y ago

Best Answer

The value. In some context 1 means 'yes', 0 means 'no'. In other contexts 0 means ok, other values are error codes.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the diff between return 0 and return 1 in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is the sum of a negative number and a positive number equal to the sum of their absolute values?

No. The sum of a negative number and a positive number has the absolute value of their difference and the sign of whichever of them was bigger - in absolute terms. So -3 + 4 = +1 (diff between 3 and 4 is 1, and the bigger number, 4, is positive) -3 + 3 = 0 (diff between 3 and 3 is 0, the sign for zero does not matter) -3 + 2 = -1 (diff between 3 and 2 is 1, and the bigger number, 3, is negative)


How would you write a user defined function to compare two strings without using the library function?

/* ellipses, ..., used to emulate indentation */ int strcmp (const char* s1, const char* s2) { ... while (s1 != NULL && s2 != NULL) { /* scan both strings */ ... ... if (*s1 < *s2) return -1; /* first string less */ ... ... if (*s1 > *s2) return 1; /* first string greater */ ... ... s1++; ... ... s2++; ... } ... if (s1 == s2) return 0; /* strings equal or both empty */ ... if (s1 != NULL) return 1 else return -1; /* first string longer(1) / shorter(-1) */ } A slightly less computation-intensive version is: int strcmp(const char* s1, const char* s2) { ... if (s1==s2) ... ... return 0; ... while (*s1) ... ... if (*s1++^*s2++) ... ... ... if (--s1<--s2) ... ... ... ... return -1; ... ... ... else ... ... ... ... return 1; ... return 0; }


What is difference between gaj or yard?

no diff 1 gaj = yard


What is the difference between direct and indirect recursion?

I hope these example will help you: static int Direct (int n) { if (n<=0) return 0; else return n + Direct (n-1); } static int InDirect (int n) { if (n<=0) return 0; else return n + Buddy (n-1); } int Buddy (int n) { return InDirect (n); }


Implementation of LZW compression algorithm in C?

{ unsigned char **dict; int *dlength; unsigned char p[80], temp[80]; char c; int plength,i,j,k,diff,cd; plength=1; cd=256; p[0]=EOF; dict= (unsigned char *)malloc(99999); //Allocating memory for Dictionary if(dict == NULL) printf("Unable to allocate memory \n"); dlength=(int *)malloc(99999); for (i = 0; i < 99999; i++) { dict[i]=(unsigned char *)malloc(60); if(dict[i]==NULL) printf("Unable to allocate memory \n"); } for (i=0;i<256;i++) //loading dictionary with ASCII set { dict[i][0]=i; dlength[i]=1; } while ((c = fgetc(Fpt)) != EOF) { if(cd==256) p[0]=(unsigned char *)c; diff=0; for (i=0; i<cd; i++) { for (k=0; k<plength; k++) //checking to see if p+c in dict { if(dict[i][k]!=p[k]) diff=1; } } if (diff==0) { p[plength]=(unsigned char)c; plength++; } if (diff==1) { for (i=0; i<cd; i++) { for (k=0; k<plength; k++) { if(dict[i][k]!=p[k]) diff=1; } if (diff==0) j=i; } fputc(j, outfile); for (i=0; i<plength; i++) { dict[cd][i]= p[i]; } dict[cd][plength]=(unsigned char)c; cd++; p[0]=c; } } for (i=0; i<cd; i++) { for (k=0; k<plength; k++) { if(dict[i][k]!=p[k]) diff=1; } if (diff==0) j=i; } fputc(j, outfile); fclose(outfile); fclose(Fpt); } By Amit Setia


Diff between 1 degrees and -17 degrees?

18


Is there a difference between you plus plus and plus plus you?

you++ will return the current value of you and increment it. ++you will increment it and then return the new value of you. So, for example: int you = 0; cout << you++; // this will print 0 cout << you; // this will print 1 int you = 0; cout << ++you; // this will print 1 cout << you; // this will also print 1


What is the difference between return 0 and return -1 in c?

If we consider any function that is not the main function that is declared as "bool" i.e it will return boolean values to the main function-0 & 1, meaning 'false' and 'true' respectively. If we have to tell the main function that the condition checked in the function is false or disagreed, then we return 0 to the main function and when we have to tell that the condition checked in the main function is true or agreed, then we return 1 to the main function.


How do you find the GCD?

int gcd (int a, int b) { if (a<0) a= -a; if (b<0) b= -b; while (a!=0 && b!=0 && a!=1 && b!=1) { int tmp; if (a>b) tmp= b, b= a, a= tmp; a= a%b; } if (a==0) return b; else if (b==0) return a; else return 1; }


How do you write a formula for if cell a is less than 88 then return 2 but if cell a is greater than 91 then return 0 and if it is anything in between those two numbers then return 1?

=if(a < 88, 2, if(a > 91, 0, 1)) Which says: if a less than 88 return 2 else if a greater than 91 then return 0 else return 1 (since a is greater than or equal to 88 and less than or equal to 91). I assume "between" in your question means inclusive - otherwise there is nothing in your question which states what to do when cell a is 88 or 91. Depending upon your spreadsheet program, the commas may need to be replaced by semicolons.


What numbers between 0?

Integers between 0 are -1 and +1


How do you write a program in c plus plus read the prime numbers between 1 and 5000?

#include <iostream> bool isPrime(int p) {if( p<=1 ( p>2 && p%2==0 ))return( false );int max = (int)sqrt(( double ) p ) + 1; for( int i=3; i<=max; i+=2 )if( p%i==0 )return( false );return( true ); } int main() {for( int i=1; i<5000; i>2?i+=2:++i )if( isPrime(i) )std::cout << i << std::endl;return( 0 ); }