computers. 1. How many times will this loop repeat? include <stdlib.h> #include <stdio.h> void main(void) int...
#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)...
#include<stdio.h> #include <stdlib.h> void read(struct Employee *e); struct Employee { int id; int age; }; int main(){ struct Employee e; read(&e); } void read(struct Employee *e){ int a,b; printf("Enter the id employee\n"); scanf("%d",&a); printf("Enter the age employee\n"); scanf("%d",&b); e->id=a; e->age=b; } Question: Declare a pointer variable of type Employee and place the address of the variable created in the above problem in that pointer variable.
1. Select all that are true for the following code. #include <stdio.h> #include <stdlib.h> void range(int start, int end, int *results) { int length = end - start; results = malloc(sizeof(int) * length); for (int i=start; i<end; i++) { *results = i; results++; } } void printArray(int *arr, int length) { for (int i=0; i<length; i++) { printf("%d ", arr[i]); } } int main() { int *x; int s = 2; int e = 11; range(s, e, x); printArray(x, e...
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...
please help, no explanation just need answer #include <stdio.h> #include <stdlib.h> int main(void) { int -x5); for (int = 0; i < 5; i++) { x[i] = malloc(sizeof (int) - 5); for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { x[i][j] = i j ; modify(x, 5, 5); return 0; Which of the implementations of method modify below set all elements of the matrix x to zero? 1. void...
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; }
Question 3 Predict the output of the following C program: #include <stdio.h> void main() { int i = 0; for(; 1; i++){ printf("%d",i); if(i==7) break; } 12pt Paragraph 1 Β Ι Ο Αν και Ta
it is a pointer operation and how to fix it? #include <stdio.h> int main(){ int a[10]={2,5,8,1,4,7,3,10,6,9}; int *MaxPtr, *MinPtr; MaxPtr=&a[0]; MinPtr=&a[0]; for (int i=1;i<10;i++){ if ((*a+i)>*MaxPtr) { *MaxPtr=*(a+i); } } for (int c=1;c<10;c++){ if (*(a+c)<*MinPtr) { *MinPtr=*(a+c); } } printf("Value of the item MaxPtr pointing at: %d\n",*MaxPtr); printf("Value of the item MinPtr...
#include <stdio.h> #include <stdlib.h> int aaa(); int main() { int ddd,eee = aaa (ddd,eee); printf("new num 1 = %d, new num2 = %d.\n", ddd,eee); return 0; } int aaa(int bbb,int ccc) { bbb = 111; ccc = 222; printf("num 1 = %d, num 2 = %d.\n", bbb,ccc); return bbb ,ccc; } Output: num 1 = 111, num 2 = 222. new num 1 = 0, new num2 = 222. ************************************************************** I am learning function in C....
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]...