The Size of
Submissions: 4363   Accuracy:

57.68%

  Difficulty: Easy   Marks: 2
Associated Course(s):   Fork CPP

Congrats on completing the introductory section of Module 1! If not, go and complete it now. If done, give yourself a pat on the back.

Now, we'll learn the use of sizeof operator in CPP. This operator is a unary type--it takes only one operand as input and outputs the size in bytes of the operand.
You will be given four different variables of different data types: a (int), b (float), c (double), l (long long), d (string). Your task is to do step-wise operations as given below:
1. Divide b by c.
2. Divide b by a.
3. Divide c by a.
4. Add result at step 3 with l.
5. Print the sizeof(result) of each step in a single line. The outputs should be separated by spaces.
6. Print the sizeof(d) and sizeof(d[3]) separated by a space.

Input Format:
First line of input conatins number of testcases T. For each testcase, there will be two lines of input. First line contains a, b, c, and l. Next line contains the string (single word).

Output Format:
For each testcase, print the required output as directed in steps.

User Task:
Your task is to complete the provided function .

Constraints:
1 <= T <= 10
1 <= a, b, c <= 106
1 <= l <= 1018

Input:
1
1 2 3 5
gfgc

Output:
4 8 4 8
32 1

Example:
Testcase 1:
b/c = 2/3 =>sizeof(2/3)=>float size is 4 bytes
b/a = 2/1 =>sizeof(2/1)=>double size is 8 bytes
c/a = 3/1 =>sizeof(3/1)=>integer size is 4 bytes
(c/a)+l =3+5= 8 =>sizeof(8)=>long long size is 8 bytes

sizeof(gfgc) = 32 => It is not 4 because of the reason listed here
sizeof(c) = 1 as it is just a character.

Note:
You can use sizeof for finding length of an array.

** For More Input/Output Examples Use 'Expected Output' option **

Author: Dhiman Mayank


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.