Programming language question ( please help if you can )
write a function f1() with the following requirements (in C language):
- It must define a local array of char values. The size must be adjustable via define macro. The default size could be, say, 1000.
- It must also define a static int n that increments the number of activation records.
- It must also define a static long int addr that stores the starting address of the array.
- Then it must print the current activation record number, the memory address of the current array, followed by the estimated size of the current activation record as a distance between the current array address and the array address from the previous activation record.
#include <stdio.h>
#define SIZE 1000
void f1(){
char values[SIZE];
static int n = 0;
long int addr = (long int )&values[0];
n++;
printf("current activation record number is %d\n",n);
addr = (long int )&values[n];
printf("The memory address of the current array is:
%d\n",addr);
printf("The estimated size of current activation record is :
%d\n",((long int)&values[n] - (long
int)&values[n-1]));
}
void main()
{
f1();
f1();
}
// Output

Programming language question ( please help if you can ) write a function f1() with the...
C PROGRAM The following is code prints the current activation record number, the memory address of the current array, followed by the estimated size of the current activation record as a distance between the current array address and the array address from the previous activation record. I need it to run until a segmentation fault occurs and also it must print the estimated size of the runtime stack as a product of the size of current activation record and the...
Hello can someone help me figure this out for my revision using C Programming. thanks! Given the following function prototype: void trimPositive(int* *arr, int *size) ; write the corresponding function definition such that: given any (dynamically allocated) array of ints and its size via the arr and size parameters, the result of your function is that: a) the int* array argument points to a new (dynamically allocated) array that is completely full, and whose values are exactly the positive values...
In C Programming Language
In this lab you will implement 4 string functions, two using array notation and two using pointers. The functions must have the signatures given below. You may not use any C library string functions. The functions are 1. int my strlen (char s ) - This function returns the number of characters in a string. You should use array notation for this function. 2. int my strcpy (char s [], char t I)- This function overwrites...
please use c ++ language and write the comment too. thanks Pointer Arithmetic Write a function that passes an array address to a function as a pointer. Using pointer arithmetic, the function determines the average, high, and low value of the array. Your function should have this header: void pointerArithmetic(int *array, int size, double &average, int &high, int &low) Parameter size is the number of elements in array. You may not use the subscript notation [] inside your function –...
Need C programming help. I've started to work on the program, however I struggle when using files and pointers. Any help is appreciated as I am having a hard time comleting this code. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE 100 #define MAX_NAME 30 int countLinesInFile(FILE* fPtr); int findPlayerByName(char** names, char* target, int size); int findMVP(int* goals, int* assists, int size); void printPlayers(int* goals, int* assists, char** names, int size); void allocateMemory(int** goals, int** assists, char*** names, int size);...
Hey everyone, I need help making a function with this directions
with C++ Language.
Can you guys use code like printf and fscanf without iostream or
fstream because i havent study that yet.
Thanks.
Directions: Write a function declaration and definition for the char* function allocCat. This function should take in as a parameter a const Words pointer (Words is a defined struct) The function should allocate exactly enough memory for the concatenation of all of the strings in the...
Please help me with MIPS programming language. Thank you 1) Write MIPS assembly for an array of words: array[12] = h + array[8]; Assume Map: $s2 = h $s3 = base address of array $t1 = temp 2) Write MIPS assembly for an array of words: g = h + array[i]; Assume Map: $s1 = g $s2 = h $s3 = base address of array $s4 = i
please help me with this question
(in C programming language and Unix)
computer system book 3 edition
int *fun (int *x)f int value *xtt return &value; int main) int pl; int **p2; int a; char str [5] printf ("Enter a number:") scanf("%d", a) ; printf ("Enter a line:") gets (str); p1-malloc(sizeof (int)) *pl-p2; p2-malloc(sizeof (int)); pl-fun (a); n-0; for (pl-stripl<-str+5;pl++) if (isdigit (pl)) at+; return 0; Construct a table that shows for each line of code, what may be the...
Homework Question Write a void function called transformArray that takes two parameters - a reference to a pointer to a dynamically allocated array of ints, and the size of that array. The pointer is passed by referencebecause you want to change the value of the pointer. The function should dynamically allocate an array that is twice as long, filled with the values from the original array followed by each of those values times 2. For example, if the array that was...
Hi
the programming language for this assignment is C programming.
Could you also please number the answers exactly as they appear in
the assignment? Thank you.
(9) 1. An array of structures is needed to keep track of 50 grocery items containing the item name, item type, cost, quantity, and tax percentage for each grocery item. The following declarations have already been done: { struct grocery char name[20], type[15]: float cost, taxp: int quan: 3 Also, the following declaration has...