ראיתי שיש פה הרבה שמתעסקים אז יש לי שאלה קטנה -
int main() {
int numcase, sizeA, sizeB, *pNewSize = 0, i, *A, *B;
while (1) {
printf("Pick a function to activate\n 1 - First paragraph\n 2 - Second paragraph\n 3 - Third paragraph\n 0 - Terminate the application\n");
scanf("%d", &numcase);
switch (numcase) {
case 0:
return 0;
printf("\n\n");
break;
case 1:
printf("Enter a size for the first array\n");
scanf("%d", &sizeA);
A = malloc(sizeA * sizeof(int));
for (i = 0; i < sizeA; i++) {
printf("Enter a number for the first array\n");
scanf("%d", &A);
}
printf("Enter a size for the second array\n");
scanf("%d", &sizeB);
B = malloc(sizeB * sizeof(int));
for (i = 0; i < sizeB; i++) {
printf("Enter a number for the second array\n");
scanf("%d", &B);
}
printf("check\n");
*symmetricDiff(*A, sizeA, *B, sizeB, *pNewSize);
printf("spcheck\n");
printf("\n\n");
free(A);
free(B);
break;
והפונקציה היא -
int *symmetricDiff(int *A, int sizeA, int *B, int sizeB, int *pNewSize)
(כל ההדפסות המיותרות הן בשביל דיבאגינג).
עכשיו הבעיה היא שאני קולט את שני המערכים וברגע שאני מגיע לקריאה לפונקציה (SYMMETRICDIFF) התכנית קורסת.
זה לא מגיע להדפסה שאחרי הקריאה ולא להדפסה שישר אחרי שנכנסתי לפונקציה.
חסכתי את כל הקוד בתכנית שלא רלוונטי לבעיה.
לא כל כך מצליח להבין למה, אשמח לעזרה 🤩
int main() {
int numcase, sizeA, sizeB, *pNewSize = 0, i, *A, *B;
while (1) {
printf("Pick a function to activate\n 1 - First paragraph\n 2 - Second paragraph\n 3 - Third paragraph\n 0 - Terminate the application\n");
scanf("%d", &numcase);
switch (numcase) {
case 0:
return 0;
printf("\n\n");
break;
case 1:
printf("Enter a size for the first array\n");
scanf("%d", &sizeA);
A = malloc(sizeA * sizeof(int));
for (i = 0; i < sizeA; i++) {
printf("Enter a number for the first array\n");
scanf("%d", &A);
}
printf("Enter a size for the second array\n");
scanf("%d", &sizeB);
B = malloc(sizeB * sizeof(int));
for (i = 0; i < sizeB; i++) {
printf("Enter a number for the second array\n");
scanf("%d", &B);
}
printf("check\n");
*symmetricDiff(*A, sizeA, *B, sizeB, *pNewSize);
printf("spcheck\n");
printf("\n\n");
free(A);
free(B);
break;
והפונקציה היא -
int *symmetricDiff(int *A, int sizeA, int *B, int sizeB, int *pNewSize)
(כל ההדפסות המיותרות הן בשביל דיבאגינג).
עכשיו הבעיה היא שאני קולט את שני המערכים וברגע שאני מגיע לקריאה לפונקציה (SYMMETRICDIFF) התכנית קורסת.
זה לא מגיע להדפסה שאחרי הקריאה ולא להדפסה שישר אחרי שנכנסתי לפונקציה.
חסכתי את כל הקוד בתכנית שלא רלוונטי לבעיה.
לא כל כך מצליח להבין למה, אשמח לעזרה 🤩