solve for the blank (make sure use C++)
#include<stdio.h>
int main()
{
int *ptr, *a;
int b, c;
int d[10];
b = 10 + 6;
c = 10 + 1;
ptr = &c;
a = &b;
for (b = 0; b < 10; b += 1)
{
d[b] = b + 2;
}
//*ptr = ____
//*a = ____
//b = ____
//c = ____
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
b = 4 + 11;
c = 7;
//*ptr = ____
//*a = ____
//b = ____
//c = ____
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
for (c = 0; c < 10; c += 2)
{
printf("%d ",d[c]);
d[c + 1] = c / 2 + 10;
}
//*ptr = ____
//*a = ____
//b = ____
//c = ____
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
a = &c;
for (c = 0; c < 10; c += 2)
{
printf("%d ",d[c]);
d[c + 1] = c / 2 + 10;
if (c % 4 == 0) { printf("\n"); }
}
//*ptr = ____
//*a = ____
//b = ____
//c = ____
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
ptr = &d[4];
a = &d[3];
for (*a = 1; *a < 4; *a += 1)
{
ptr[*a] = *a + 1;
printf("%d %d\n", *a, ptr[*a]);
}
//*ptr = ____
//*a = ____
//b = ____
//c = ____
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
printf("--\n%d\n--\n", *d + 8);
printf("--\n%d\n--\n", ptr[30 % 5] + 8);
return(0);
Answer:
11 10 10 11 650167936 7 15 15 7 650167936 2 4 6 8 10 10 15 15 10 650167936 2 4 6 8 10 10 10 15 10 650167936 1 2 2 3 3 4 6 4 15 10 650167936 -- 10 -- -- 14 --
above values are blanks values sequence
detailed program for run
above program modified for run
#include<stdio.h>
int main()
{
int *ptr, *a;
int b, c;
int d[10];
b = 10 + 6;
c = 10 + 1;
ptr = &c;
a = &b;
for (b = 0; b < 10; b += 1)
{
d[b] = b + 2;
}
//*ptr = ____
printf("%d\n", *ptr);
//*a = ____
printf("%d\n", *a);
//b = ____
printf("%d\n", b);
//c = ____
printf("%d\n", c);
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
printf("%d\n", d);
b = 4 + 11;
c = 7;
//*ptr = ____
printf("%d\n", *ptr);
//*a = ____
printf("%d\n", *a);
//b = ____
printf("%d\n", b);
//c = ____
printf("%d\n", c);
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
printf("%d\n", d);
for (c = 0; c < 10; c += 2)
{
printf("%d ",d[c]);
d[c + 1] = c / 2 + 10;
}
//*ptr = ____
printf("%d\n", *ptr);
//*a = ____
printf("%d\n", *a);
//b = ____
printf("%d\n", b);
//c = ____
printf("%d\n", c);
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
printf("%d\n", d);
a = &c;
for (c = 0; c < 10; c += 2)
{
printf("%d ",d[c]);
d[c + 1] = c / 2 + 10;
if (c % 4 == 0) { printf("\n"); }
}
//*ptr = ____
printf("%d\n", *ptr);
//*a = ____
printf("%d\n", *a);
//b = ____
printf("%d\n", b);
//c = ____
printf("%d\n", c);
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
printf("%d\n", d);
ptr = &d[4];
a = &d[3];
for (*a = 1; *a < 4; *a += 1)
{
ptr[*a] = *a + 1;
printf("%d %d\n", *a, ptr[*a]);
}
//*ptr = ____
printf("%d\n", *ptr);
//*a = ____
printf("%d\n", *a);
//b = ____
printf("%d\n", b);
//c = ____
printf("%d\n", c);
//d = ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
printf("%d\n", d);
printf("--\n%d\n--\n", *d + 8);
printf("--\n%d\n--\n", ptr[30 % 5] + 8);
return(0);
}
solve for the blank (make sure use C++) #include<stdio.h> int main() { int *ptr, *a; int...
What is the output of the following code? #include« stdio.h» 2 4 int main() 6 int a=15,b=12,c=5, d-e; 7 printf("the value of d is %d",d); return 0; 8 9 10 Ly 0 29 O 30 0 28 O 31
Solve using C programming 3. lf you are given this code. #include <stdio.h> int main() int var1, var2; int sum; printf("Enter number 1:\n "); scanf("%d",&var1); printf("Enter number 2:In ); scanf("%d",&var2); sum-var1+var2; printf ("Vnsum of two entered numbers : %d", //printf ("Output: %d", res); sum); return e; Modify this code by creating a function called "addition". Make the arguments of the functions numberl and number 2. Add the two values in the function. Return a value called "result". Print "result" in...
#include<stdio.h> int f(int a,int b); int main(){ int a=8, b=4,c=2; b = f(c,a); printf("a=%d,b=%d\n,a,b,c); c = f(a+3,b-2); printf("a=%d,b=%d,c=%d\n",a,b,c); return 0; } int f(int a, int b){ a=b+6 b=a-2 printf("a=%d,b=%d\n",a,b); return a+b; } what is the first line of output produced? what is the second line of output? what is the third line if output? what is the forth line of output? if there is problems ill post the choices thank you
Having an issue with pointers and functions. #include <stdio.h> int f(int *a, int *b); int main() { int a = 2, b = 7; b = f(&b, &a); printf("a = %d,\n", a); printf("b = %d\n", b); return 0; } int f(int* a, int* b) { (*a) = (*a) + 3; (*b) = 2*(*a) - (*b)+5; printf("a = %d b = %d\n", *a, *b); return(*a)+(*b); } can someone explain to me why the output is a =...
i need flowchart for the following c code #include <stdio.h> int main() { int n, i, sum = 0; printf("Enter an integer: "); scanf("%d",&n); i = 1; while ( i <=n ) { sum += i; ++i; } printf("Sum = %d",sum); return 0; }
Debug to print output "2 3 5 6 8 11": #include <stdio.h> #include <stdlib.h> int main() { int i, j, n; int A[] = {2, 3, 5, 5, 5, 6, 8, 11, 11, 11}; n = sizeof(A) / sizeof(int); for (i = 0; i < n - 1; i++){ if (A[i] != A[i + 1]) { for (j = 1; j < n - 1; j++) { A[j]...
Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() { int number; scanf("%d", &number); if (number % 2 == 0) { printf("Even\n"); } else { printf("Odd\n"); } return 0; }
All in C please~ #1 Consider this program: #include <stdio.h> int main () { /* main */ constint constant1 = 10, constant2 = 20, constant3 = 14; int input_value; char current_truth; printf("What is the input value?\n"); scanf("%d", &input_value); current_truth = input_value > constant1; printf("current_truth = %d\n", current_truth); current_truth = current_truth && (input_value < constant2); printf("current_truth = %d\n", current_truth); current_truth = current_truth && (input_value == constant3); printf("current_truth = %d\n", current_truth); } /* main */ What is the output of this program...
Complete this program in C #include<stdio.h> int main(void) { int sumA(__, __); int answer; //the two parameters are start and end addresses of intA[] answer = sumA(......); printf("..........", intA); printf("The sum of integers in intA is %d.\n", answer); return 0; } //the two parameters of sumA(__, __) are start and end addresses of intA[] int sumA(..........) { ……………………. return ............. }
6. Consider the following program: #include <stdio.h> main() { int a,b,c,d ; a=0; while (1) { printf("%d\n", a); printf("Input? "); scanf("%d",&c); if (c == 0) break; d=0; for (b=1; b<=c; b++) if (c%b == 0) d++; if (d == 2 11 C == 1) a=a+c; } } What does this program do? Rewrite the code, organizing it using sound principles. Include comments and redo variable names and indentation. Use multiple functions, blocks, and/or preprocessing if you deem it necessary.