so i kno how to split a string and use a portion of it after the 0 marker but wut if i wanted to use the first half of a string instead of the second half how do i go about do tthat? heres an my code. if u look at the last line im trying to split string one and display the first half and the second half of string to together
Code:
#include <stdio.h>
#include <string.h>
int main()
{
char string1[255];
char string2[255];
/*not sure if the \0 rule applies to individual char strings so i made it 255 instead of 254*/
int length1;
int length2;
printf("Program: String Processing\n");
printf("Author: VeXxRaptor\n\n");
/* * * * * * * * * * * * * * * * * * * * */
printf("Enter the string1: ");
gets(string1);
printf("Enter the string2: ");
gets(string2);
length1=strlen(string1);
length2=strlen(string2);
printf("\nString 1 is %d bytes long, and string2 is %d bytes long.\n",length1,length2);
/*Prints variables 1 & 2 total string length to the screen*/
printf("%s%s", string1, string2 +10);
getchar();
return 0;
}