Get a data in a linked list, find Operations C language implementation

Source: Internet
Author: User
SN *get_s_node (sn *head) {/* head is the header pointer of the linked list to be queried */sn *get_s_node = Null;int32 OSM = 1,i32i = 0, Data_num = 0;/* OSM is a marker, i32i is a variable in the loop body, data is the ordinal of the element to get */get_s_node = (SN *) malloc (sizeof (SN)); Get_s_node = head;/* Enter the data to get */OSM = osm_printf ("Enter the ordinal to get");d Ata_num = Scanf_for ();/* Enter the ordinal of the element to get */while (i32i < dat A_num)/* Loop through the list to find the ordinal data */{get_s_node = get_s_node->next;/* point to the next */if (Data_num = get_s_node->sensor_rating)/  * Determine if it is a found ordinal */{osm = osm_printf ("The ordinal of the query is%d\n", data_num);/* Print */if after found (NULL! = get_s_node->sensor_title)/        * Verify the validity of the pass parameter */{OSM = osm_printf ("The data queried is%s\n", Get_s_node->sensor_title);}} i32i++;/* loop body variable plus 1 */}return head;}

Get a data in a linked list, find Operations C language implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.