Please help me debug the following code
#include
int main(void){
int a = 11, b = 5;
int *ptr1 = &a, *ptr2 = &b;
printf("%d %d\n", *ptr1, *ptr2);
swap(&ptr1, &ptr2);
printf("%d %d\n", *ptr1, *ptr2);
minimum(ptr1, ptr2);
printf("%d %d\n", a, b);
return 0;
}
// Part A
void swap(int **ptr1, int **ptr2){
int *temp = *ptr1;
*ptr1 = *ptr2;
*ptr2 = temp;
return;
}
// Part B
void minimum(int *ptr1, int *ptr2){
if(*ptr1 > *ptr2){
*ptr1 = *ptr2;
}else{
*ptr2 = *ptr1;
}
return;
}
i dont know what im not declaring please show debugged code below just for reference
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
Please help me debug the following code #include int main(void){ int a = 11, b =...
C++ 1. A?B?C?D? which one is correct 2. 3A, 3B #include<iostream> using namespace std; void swap0(int* ptri, int* ptr2) { int *temp; temp = ptr1; ptr1 = ptr2; ptr2 = temp; void swap1(int ptri, int ptr2){ int temp; temp = ptri; ptr1 = ptr2; ptr2 = temp; portion void swap2(int *&ptri, int *&ptr2){ int* temp; temp = ptr1; ptr1 = ptr2; ptr2 = temp; void swap3(int &ptri, int &ptr2) { int temp; temp = ptr1; ptr1 = ptr2; ptr2 =...
Convert the below C code to basic MIPS. Please leave comments for explanation #include <stdio.h> int main(void) { printf("Insert two numbers\n"); int a,b; scanf("%d",&a); scanf("%d",&b); a=a<<2; b=b<<2; printf("%d&%d\n",a,b); return 0; }
Convert the below C code to basic MIPS. Leave comments for explanation please #include <stdio.h> int main(void) { printf("Insert two numbers\n"); int a,b,c; scanf("%d",&a); scanf("%d",&b); c=a|b; printf("%d|%d=%d\n",a,b,c); return 0; }
Fix the errors in C code #include <stdio.h> #include <stdlib.h> void insertAt(int *, int); void Delete(int *); void replaceAt(int *, int, int); int isEmpty(int *, int); int isFull(int *, int); void removeAt(int *, int); void printList(int *, int); int main() { int *a; int arraySize=0,l=0,loc=0; int choice; while(1) { printf("\n Main Menu"); printf("\n 1.Create list\n 2.Insert element at particular position\n 3.Delete list.\n4. Remove an element at given position \n 5.Replace an element at given position\n 6. Check the size of...
#include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(void) { /* Type your code here. */ int GetNumOfNonWSCharacters(const char usrStr[]) { int length; int i; int count = 0; char c; length=strlen(usrStr); for (i = 0; i < length; i++) { c=usrStr[i]; if ( c!=' ' ) { count++; } } return count; } int GetNumOfWords(const char usrStr[]) { int counted = 0; // result // state: const char* it = usrStr; int inword = 0; do switch(*it)...
Three is 3 questions please answer them all Question 1 int main(void) { int x = 10, y = 20; if (x == y); printf ("\n%d %d",x,y); } Output as you would see on the compiler: Question 2 int main(void) { int x = 3, y = 5; if (x == 3) printf ("\n%d",x); else ; printf("%d", y); return 0; Output as you would see on the compiler: Question 3 int main(void) { int x = 3; float y =...
help me 27 28 29 return *a-- * ++*b; void main() { int x = 6, y = 8; x = func(y, y); printf("x - %d, y = %d\n", x, y); X = sub(&y, &y); printf("x = %d, y = %d\n", x, y); } Ans: PART 3 Writing questions [3 marks) 27. (L.0.3.1) Draw a flowchart to accept two number a and b. Find the sum of all odd numbers between a and b. 28. (L.0.4.3) What is the difference...
why is correct the output of this code? #include <stdio.h> int main( void ) { char val[] = "one"; if (val[1] = 'o') printf("correct"); else printf("incorrect"); }
PUT INTO PYTHON CODE #include <stdio.h> #include <float.h> int main(void) { float a = 1; float b = 0.5; float c = a + b; int bits = 0; while (c != a) { bits = bits + 1; b = b / 2; c = a + b; } printf("%d\n",bits); return 0; }
I need the pseudocode for this c program source code. #include<stdio.h> void printarray(int array[], int asize){ int i; for(i = 0; i < asize;i++) printf("%d", array[i]); printf("\n"); } int sum(int array[], int asize){ int result = 0; int i = 0; for(i=0;i < asize;i++){ result = result + array[i]; } return result; } int swap( int* pA,int*pB){ int result = 0; if(*pA > pB){ int tamp = *pA; *pA = *pB; *pB = tamp; result = 1; } return result;...