answersLogoWhite

0

#include
void main()
{
char str1[10],str2[10];
int i=0;
int flag = 0;


printf("enter first string\n");
scanf("%s",str1);


printf("enter second string\n");
scanf("%s",str2);


while(str1[i]!='/0' && str2[i]!='/0')
{
if(str1[i]!=str2[i])
flag=1;
if(flag==1)
{
printf("not equal\n");
break;
}
if (flag==0)
{
printf("equal\n");
break;
}
}
}

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Character arrays using pointers notes?

i don't know ask someone else


Write a c program to copy two strings using pointers?

nahi malum


How can you do the same thing as the program below but using strings and arrays in C language?

Program below?!


What is the source code for attendance record system in c language using pointers functions arrays whichever required?

bmbmbvjmgjmgj


Is it possibly to return an array of strings in a function without using pointers in C plus plus?

No.


How do you swap two arrays in c plus plus using string?

You can't. While a string is a character array, an array is not necessarily a string. Treating arrays as if they were strings simply to swap them is madness. The correct way to physically swap arrays A and B is to copy A to a new array, C, then copy B to A, then C to B. If the arrays are the same size this is not a problem. If they are different sizes, you can only swap them if they are dynamic (not static). This means you must reallocate them. To speed up the process, copy the smallest array to C, first. A much better approach would be to point at the two arrays and swap the pointers instead.


Pointer to 3 dimensons array?

If the array is static you can simply point at the first element. For dynamic arrays you can allocate a contiguous block to a single pointer which can then be subdivided using a one-dimensional array of pointer to pointers, each of which points to a one-dimensional array of pointers, each of which points to a separate object within the array. For extremely large arrays, however, it is better to split the elements into separate one-dimensional arrays, by creating a one-dimensional array of pointer to pointers first, then allocating each of those pointers to a separate one-dimensional array of pointers, each of which points to a separate one-dimensional array of objects. Either way, you must destroy all the individual arrays in the reverse order of creation.


How do you write a C program to copy to strings using pointers?

mystrcpy (char* dest, char* src) { while ((*dest++ = *src++) != '\0); }


How to perform string operations like concatenation compare etc without using built in functions?

performing string operation using pointers


How do you print my name in c program in vertical manner using arrays?

you need strings to print any character(your name) this is not possible useing array:D


Can you tell me a C program to find if the strings are equal using pointers?

It is called strcmp, part of the standard run-time library. Returns 0 if the two strings are equals, non-zero otherwise.


How are string stored in c language?

Strings represented by the language character set (e.g., ASCII) are stored as null-terminated arrays of type char. Wide-character strings are stored as null-terminated arrays of type wchar_t. Other types are also available, such as char16 and char32 (for UTF16 and UTF32 encodings, respectively).