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

SIMPLE PYTHON HTTP SERVER

SIMPLE PYTHON HTTP SERVER In many use cases, we come across the situation where we need a simple server to test some command or test some applications. But creating a server programmatically is a time taking process. To solve the problem Python has created SimpleHTTPServer module. In this post, we will learn how to create a simple HTTP server in a single command on Ubuntu.  Create SimpleHTTPServe Using Commandline  python -m SimpleHTTPServer 8001 Above command will create a simple HTTP server for you at port 8001 Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Golang - Run & Compile

GOLANG RUN & COMPILE In the previous post, we have discussed how to install Go on Linux. In this post, We will discuss how to compile and run a Go program. Create folder HelloWorld mkdir HelloWorld cd HelloWorld Create file HelloWorld.go touch HelloWorld.go Copy below code into HelloWorld.go file package main import "fmt" func main() { fmt.Println("Hello, World") } Compile go build Run ./HelloWorld Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

BSNL Recruitment

BSNL Recruitment      Bharat Sanchar Nigam Limited (BSNL)  has released a notification for the post of   Management Trainees . Company Name BSNL Post Name    Management Trainees State India Salary Rs.  24,900-50,500 Number of Vacancy 300 Eligibility B.Tech Last Date 26-01-2019 Application Details Job Notification Apply Online Job Application BSNL Recruitment       Government Jobs in India Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. Rozgardesh ( रोजगार देश )

South East Central Railway: SECR

South East Central Railway: SECR Company Name         :  South East Central Railway: SECR Post Name                       :   Apprentice State                            :  Maharashtra Salary                           :  Number of Vacancy   :  313 Eligibility                     :  10th Pass  Last Date to Apply     :  15-09-2018 Application Details    :  Notification Apply Online              :  Apply Here Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.