Answers for "c++ strcmp"

C++
2

strcmp c++

#include<stdio.h> 
#include<string.h> 


int main() 
{  
      
    char char1[] = "coucou"; 
    char char2[] = "coucou"; 
      
  	if( strcmp(char1, char2) == 0 )
       printf("Strings are the same");
  
  	else
      prinf("Strings are differentes");
  
  
    return 0; 
}
Posted by: Guest on July-09-2020
0

c++ strcpy_s

//When to use strcpy_s:
//	Use strcpy_s to copy a const char[] array in read and write memory
//How to use strcpy_s:

//The location where the array is going to be copied to
char* ptrToArray = new char[sizeof(testArray)]

//The Array that gets copied To ptrToArray;
const char[] testArray = "Test Array";

strcpy_s(ptrToArray, sizeof(testArray), testArray);

//Modify the copied array
testArray[i] = 'A'
Posted by: Guest on May-05-2021

Browse Popular Code Answers by Language