Skip to main content

OFFSET in Computer Science

OFFSET in Computer Science

In the post, We will understand what is the meaning of OFFSET in computer science with an example.
In computer science offset comes picture at may place like packing a data structure, encoding the data etc in some standard protocol so that other parties can deserialise it and understand the data. We will understand its important how does it work with example. suppose we have a data structure for a student like
 {  
 name:string[20]  
 roll: int[4]  
 course: string[25]  
 batch: int[4]  
 }  

We want to serialise below student data 
 {  
 name:"Amit Gupta"  
 roll: 1234  
 course:Computer Science"  
 batch: 2018  
 }  
Our protocol follow the rule that we will insert a value and if space will remain empty we will fill it with $ for example length of "Amit Gupta" is 10 but standard size is 20 so will fill 10 $ after "Amit Gupta". So serialisation of above data will be
 Amit Gupta$$$$$$$$$$1234Computer Science$$$$$$$$$2018  
So according to our data structure
  • OFFSET of name will be zero and length will 20
  • OFFSET of roll will be 20 and length will 4
  • OFFSET of course will be 24 and length will 25
  • OFFSET of batch will be 49 and length will 4
So from above you can clearly say that OFFSET of any variable or character is number of character before it.
Now for example we can encode it into base64 before sending it third party. So base64 encoding of above string will be
 IEFtaXQgR3VwdGEkJCQkJCQkJCQkMTIzNENvbXB1dGVyIFNjaWVuY2UkJCQkJCQkJCQyMDE4ICA=  
Other can decode it and now he know how to deserialise because of protocol definition from 0 to 20 character he will consider as name and ignore the $ symbol next 20 to 24 as roll, 24 to 49 as course and 49 to 53 as batch.


Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. 

Comments

  1. This post will prove very useful for computer science students. My sister is also a computer science student. I will definitely share this post with her. In-spite of it, she is doing her preparation from typical student. Whenever she has doubts in any subject she immediately visit the site and get solutions from there.

    ReplyDelete
    Replies
    1. Thanks a lot. We will be posting more great educational blogs in near future.

      Delete
  2. Thank you so much for post. It is really help full. If any one want to know about R-Programming Language.
    R Programming training Center in Delhi/NCR

    ReplyDelete
  3. Thanks for sharing information with us,I would appreciate if you could share more information about software courses
    e accounting training course in delhi

    ReplyDelete
  4. Hi I have tried it before but I made an error. You write correctly that "OFFSET of roll will be 20 and length will 4" I used the length 5 instead of 4. You are awesome. Keep it up. Thanks for writing.

    ReplyDelete
  5. Your blog provided us with valuable information to work with. Thanks a lot for sharing. Outsource support increased expertise, Expand resource and Efficiency. For the Outsource support you can visit on outsourced hosting support

    ReplyDelete
  6. Thanks for sharing the valuable post. To get to know about off page optimization plz vist the below link
    Digital Marketing Training in Chennai

    ReplyDelete
  7. Quite informative blog .One could easily get into Aviation Domain with Degree in Computer Science. Multiple Aviation Courses are available to get into Aviation industry.
    Aviation Training in Chennai
    Airport Ground Operations Training
    Cabin Crew Training In Chennai
    Pilot Training In Chennai
    Flight Dispatcher Training In Chennai

    ReplyDelete
  8. There is lots of post about SAP But Your Post way of Writing and knowledgeable information is So Good and Unique. Keep Writing
    Sap Training Course in Delhi
    Sap Training Course in Noida
    Sap Training Course in Gurgaon

    ReplyDelete
  9. This is an awesome post. Really very informative and creative contents. I really appreciate your post. Thanks for sharing it. To Know More Visit Here: Rajendra Geda

    ReplyDelete
  10. Ascend Aviation Pilot training program. Ascend aviation is the pinnacle of aviation training cum placement assistance institution located in southern part of india. Click on link below, To know more about our programs .
    Aviation Course in Chennai
    Airport Ground Operations Training
    Cabin Crew Training In Chennai
    Pilot Training In Chennai
    Flight Dispatcher Training In Chennai
    Aviation Training in Chennai
    Air hostess training
    Aviation Academy in Chennai

    ReplyDelete
  11. it's really a piece of new information to me, I learn more from this blog, I want to learn more from this blog, keep on it doing, I eagerly waiting for your updates, Thank you!!!

    Best Aviation Academy in Chennai

    Best Air hostess Training in Chennai

    Pilot Training in Chennai

    Airport Ground Handling Training in Chennai

    Airport Flight Dispatcher Trainee in Chennai

    RTR- Aero Training in Chennai

    For more... facebook

    ReplyDelete
  12. I read Your Post about E-accounting and I must say it is really one of the finest Post. It’s really unique and knowledgeable information
    E-accounting training in Delhi
    E-accounting training in Noida
    E-accounting training in Gurgaon

    ReplyDelete
  13. This app explains the importance of why you need to update any application over time. You can opt for quality mobile app maintenance online for a wide range of information.

    ReplyDelete
  14. it was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity.. This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points.



    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery





    ReplyDelete

Post a Comment

Popular posts from this blog

Average

Average In this post, We will learn about average.  Average of any collection of data is the sum of data divide by number of data. Average = (Sum of observations /  Number of observations) Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.  problems The arithmetic mean of x, y and z is 80, and that of x, y, z, u and v is 75, where u=(x+y)/2 and v=(y+z)/2. If x ≥ z, then the minimum possible value of x is (CAT 2018) As specified in the question mean of x and y and z is 80 x+y+z=3*80 mean of x, y, z,u,v is 75 x+y+z+u+v=75*5 2u=x+y 2v=y+z x+y+z+((x+y+y+z)/2)=75*5 y+3(x+y+z)=75*10 y=750-720 y=30 since x+y+z=240 y=30 so x+z=210 since x>=z so minimum value of x=210/2 = 105 Problem2: In first 5 inings sehwag has scored at average of 40. In sixth ining He had scored 52 what is His average after 6th ining. one simple approach is getting total score divided by no of inin...

Set Theory

Set Theory Set Theory is a branch of mathematics in which we study about sets and their properties. Georg Cantor (1845-1918), a German mathematician, initiated the concept ‘Theory of sets’ or ‘Set Theory’. He was working on “ Problems on Trigonometric Series ” when he encountered something that had become the most fundamental thing in mathematics. Set theory is the fundamental theory in mathematics. Without sets, it is not possible to explain relations, functions, sequences, probability, geometry etc. Apart from this, Cantor also conceptualized that some of the infinities are countable and others are uncountable. He introduced the fact that the uncountable infinite set of real numbers is larger than the countable infinite set of integers. This is known as Cantor’s diagonal argument. Let us now go ahead and learn the meaning of sets in maths. Sets: To understand sets, consider a practical scenario. While going to school from home, Nivy decided to note down the ...

Conditional Statements in C

Conditional Statements In c programming language, decision making is used to specify the order in which statements are executed. In C we use conditional statements to achieve this. There can be any type of control structures. In our daily life, these kinds of control structures generally achieve or used in our decision-making process. Control Structures types. If then            If I exercise daily then I will be fit If else             If today rains then I will play FIFA else I will not play FIFA. else if      In programming, we use a conditional statement to make decisions in the same way as in real life. If Statement Example if the expression it true evaluate the statement. if (expession) { statement } C example. You have given a number, check if the number is positive print Positive on the terminal. if (number > 0) { printf("Positive"); } ...