Search
 
SCRIPT & CODE EXAMPLE
 

C

equal string c

#include <string.h>
// strcmp is a function from the stadard string library that returns 0 of both strings are equals

int main () {

	// for exemple
	char[] str1 = "Hey!";
  	char[] str2 = "Hey!";
  	char[] str3 = "Hola";
  
  	// instead of "if (str1 == srt2)" you'll need to use
  	if (strcmp(str1, str2) == 0)
        printf("str1 = str2
");
	
  	if (strcmp(str1, str3) != 0)
        printf("str1 != str2
");
  
	return 0;
}
Comment

c string equal

int strEqu(char *a, char *b)
{
	int i = 0;
	while (1)
	{
		if (*(a + i) == 0 && *(b + i) == 0) return 1;
		else if (*(a + i) != *(b + i)) return 0;
		i++;

	}

}
Comment

PREVIOUS NEXT
Code Example
C :: lateinit kotlin 
C :: how i send custom data in model field rest_framework serializer 
C :: simple calculator, using switch statement in C 
C :: 2 dimensional array in c 
C :: how to add 1 to 10 in c 
C :: arrays in c 
C :: Program to input and print array elements in c 
C :: printing out an array in c from user input 
C :: stack push 
C :: printf("%3d ",XX); 
C :: convert string to int error checking c 
C :: what is c 
C :: create node in c 
C :: Complete the function in the editor. It has one parameter: an array, . It must iterate through the array performing one of the following actions on each element: 
C :: pasar a binario recursivo 
C :: pointer arithmetic on Arrray in c 
C :: how to print % in c 
C :: string in c and how it works 
C :: integer in c 
C :: string in c 
C :: Regex to match any character being repeated more than 10 times 
C :: marquee html code with right 
C :: fifo page algorithm in C 
C :: como somar em C 
C :: c to assembly online compiler 
C :: epita 
C :: how to output in green in c 
C :: difference between %d and %i 
C :: gnuplot rectangle border color 
C :: shortest job first 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =