User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:control_structures:return

return

   #include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
   return value;

returns a value

C Sourcecode Example

#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
#include <stdlib.h>
#include <string.h>
 
int yesno( char value1[], char value2[] ){
 
    if ( strcmp( value1, value2 ) == 0)
	{
	    return 0;
	} else {
	    return 1;
	    }
}
 
int main(void) {
 
    char str1[]="ADS";
    char str2[]="FJK";
 
	if ( yesno( str1, str1 ) == 0 ) {
	    printf("same\n");
	    } else { printf("different\n"); }
 
	if ( yesno( str2, str2 ) == 1 ) {
	    printf("different\n");
	    } else { printf("same\n"); }
 
	if ( yesno( str1, str2 ) == 0 ) {
	    printf("same\n");
	   } else { printf("different\n"); }
 
return 0;
}
  output:
  
  same
  same
  different

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/control_structures/return.txt · Last modified: 2024/02/16 01:04 (external edit)

Impressum Datenschutz