Qualcomm Interview Question
Software Engineer / DevelopersNot correct. What if length of s < n? You try to copy over more than required, which might segfault, lead to exploits etc.
More details about the contract of strncpy are needed, though.
Not correct. What if length of s < n? You try to copy over more than required, which might segfault, lead to exploits etc.
More details about the contract of strncpy are needed, though.
is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
Here is the code for the same :
- AB September 06, 2008#include<stdio.h>
#include<string.h>
void StringCopy(char[], char[]);
int main()
{
char sample[] = " Hello World";
char sampleCopy[20];
int i =0,j=0;
printf("\n The original string is :" );
for(i=0;i<strlen(sample);i++)
{
printf("%c",sample[i]);
}
StringCopy(sample,sampleCopy);
printf("\n The copied string is :");
for(j=0;j<strlen(sampleCopy);j++)
{
printf("%c",sampleCopy[j]);
}
return 0;
}
void StringCopy(char *str1, char *str2)
{
while(*str1 != '\0')
{
*str2++ = *str1++;
}
*str2 = '\0';
}