No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Hello, I'm just started to study malloc and realloc, so i just wrote this program to copy two string from user input and consenterate them. then ofcource print it. #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char *str = malloc(3) gets(str); int sl = strlen(str); str = realloc(str, … |
|
Hi, Let's say I have an array of 10 elements. I want user to enter 9 numbers so that they fill arrays 0 to 8 (9 numbers). Now I shift the arrays +1. so array[0] is now array[1] and so on. Now I ask user to enter 10th number (fills … |
|
Hi, This two parts of code both are intended to do one thing. get two numbers from user, calculate sum between them. print it. now only the first code is working properly. second one is faulty. but why? what's the problem? code no1: #include <stdio.h> int main() { int n, … |