Question

In: Computer Science

Using C: Implement function types that takes no input, declares 3 variables of type char, 3...

Using C:

Implement function types that takes no input, declares 3 variables of type char, 3 of type short, 3 of type int, and 3 of type double---in that order---and prints the addresses of the 12 variables---in the same order---in both hex (use %p conversion instruction) and unsigned long format.

&a1 = 0x7ffd45e3ac0f, 140725776002063
&a2 = 0x7ffd45e3ac0e, 140725776002062
&a3 = 0x7ffd45e3ac0d, 140725776002061
&b1 = 0x7ffd45e3ac0a, 140725776002058
&b2 = 0x7ffd45e3ac08, 140725776002056
...

Solutions

Expert Solution

C CODE:

#include<stdio.h>

//function to print the address of the various types variables
void types()
{
  
   //3 character variables
   char c1,c2,c3;
  
   // 3 short int variables
   short int s1,s2,s3;
  
   // 3 int variables
   int i,j,k;
  
   //3 double variables
   double p,q,r;
  
   //printing the address of the above variables
   //in hexadecimal and long unsigned int format
   printf("&c1 = %#p ,%lu",&c1,&c1);
   printf("\n&c2 = %#p ,%lu",&c2,&c2);
   printf("\n&c3 = %#p ,%lu",&c3,&c3);
   printf("\n&s1 = %#p ,%lu",&s1,&s1);
   printf("\n&s2 = %#p ,%lu",&s2,&s2);
   printf("\n&s3 = %#p ,%lu",&s3,&s3);
   printf("\n&i = %#p ,%lu",&i,&i);
   printf("\n&j = %#p ,%lu",&j,&j);
   printf("\n&k = %#p ,%lu",&k,&k);
   printf("\n&p = %#p ,%lu",&p,&p);
   printf("\n&q = %#p ,%lu",&q,&q);
   printf("\n&r = %#p ,%lu",&r,&r);
  
  
}
int main()
{
  
   //calling the function types()
   types();
  
}

SCREENSHOT FOR OUTPUT:


Related Solutions

Implement function noVowel() that takes a string s as input and returns True if no char-...
Implement function noVowel() that takes a string s as input and returns True if no char- acter in s is a vowel, and False otherwise (i.e., some character in s is a vowel). >>> noVowel('crypt') True >>> noVowel('cwm') True >>> noVowel('car') False Implement function allEven() that takes a list of integers and returns True if all integers in the list are even, and False otherwise. >>> allEven([8, 0, -2, 4, -6, 10]) True >>> allEven([8, 0, -1, 4, -6, 10])...
c++ Write the definition of a function named ‘isLower’ that takes as input a char value...
c++ Write the definition of a function named ‘isLower’ that takes as input a char value and returns true if the character is lowercase; otherwise, it returns false.•Print the message “The character xis lowercase” when returned value above is true, and vice versa.
C Implement the function Append (char** s1, char** s2) that appends the second character array to...
C Implement the function Append (char** s1, char** s2) that appends the second character array to the first, replaces the first array with the result and replaces the second character array with the original first array. For example, if the first character array is "hello" and the second is "world" at the end of the function the new value of the first character array should be"helloworld" and the second array should be "hello". If the input is invalid the function...
Implement the following function: a. float temp(float t, char ch) – this function takes temperature ‘t’...
Implement the following function: a. float temp(float t, char ch) – this function takes temperature ‘t’ and unit of temperature ‘ch’ as parameter. The variable ‘ch’ will be either f or c depending on whether the temperature in variable ‘t’ is in Fahrenheit or Celsius. The function returns the converted temperature to the main method. Call the above function in the main method. Initialize temperature and unit of temperature from the user and pass them as parameter to the above...
5.16 Implement function indexes() that takes as input a word (as a string) and a onecharacter...
5.16 Implement function indexes() that takes as input a word (as a string) and a onecharacter letter (as a string) and returns a list of indexes at which the letter occurs in the word. >>> indexes('mississippi', 's') [2, 3, 5, 6] >>> indexes('mississippi', 'i') [1, 4, 7, 10] >>> indexes('mississippi', 'a') []
4.31 Implement function duplicate() that takes as input the name (a string) of a file in...
4.31 Implement function duplicate() that takes as input the name (a string) of a file in the current directory and returns True if the file contains duplicate words and False otherwise. duplicate('Duplicates.txt') True duplicate('noDuplicates.txt') False Please solve using Python Language and without using str.maketrans please. Just simple programming, Thank youuuuu!!!!!
Using C: Implement four versions of a function funSum that takes a positive integer n as...
Using C: Implement four versions of a function funSum that takes a positive integer n as input and returns the sum of all integers up to and including n that are divisible by 6 or 7: using a for loop in funSum1, using a while loop in funSum2, using a do-while loop in funSum3, and using recursion in funSum4. Your output for the included test code should be: funSum1(20) = 57 funSum2(20) = 57 funSum3(20) = 57 funSum4(20) = 57
Write a boolean function named isMember that takes two arguments: an array of type char and...
Write a boolean function named isMember that takes two arguments: an array of type char and a value. It should return true if the value is found in the array, or false if the value is not found in the array. PLEASE WRITE FULL PROGRAM IN C++ AND USE RECURSION AND DO NOT USE LOOPS
in c++ Write a function that takes a C string as an input parameter and reverses...
in c++ Write a function that takes a C string as an input parameter and reverses the string. The function should use two pointers, front and rear. The front pointer should initially reference the first character in the string, and the rear pointer should initially reference the last character in the string. Reverse the string by swapping the characters referenced by front and rear, then increment front to point to the next character and decrement rear to point to the...
Python Implement function noVowel() that takes a string s as input and returns True if no...
Python Implement function noVowel() that takes a string s as input and returns True if no char- acter in s is a vowel, and False otherwise (i.e., some character in s is a vowel). >>> noVowel('crypt') True >>> noVowel('cwm') True >>> noVowel('car') False
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT