language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C |
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/semaphore.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <asm/uaccess.h>
#include <linux/sched.h>
/*
Taylor Okel
Operating Systems
Fall 2015
Lab 6
Credit:
Prof Franco - Lab 6 description
Kevin Farley - general ideas and dire... |
C | #include <stdio.h>
#include <stdlib.h>
#include "circular_list.h"
main()
{
LIST_PTR list;
elem temp;
CL_init(&list);
CL_insert_start(&list, 1);
CL_print(list);
printf("\n");
CL_insert_start(&list, 2);
CL_print(list);
printf("\n");
CL_insert_after(list->next, 3);
CL_print(list)... |
C | /*
this file contains basic singly linked list operations.
create = creates a linked list with user inputs. stops when -999 is given as input
insertAfter = inserts a number after a particular node in the list
insertBefore = inserts a number before a particular node in the list
delete = deletes a node
printList = prints... |
C | #ifndef DIFFERENCE_H
#define DIFFERENCE_H
#include "color.h"
// Math shamelessly taken from https://en.wikipedia.org/wiki/Color_difference
// Finds the difference between the two colors using the deltaE 2000 method by CIE
// Note: this function is quasimetric
// You may get a different result by plugging in (x, y) th... |
C | #pragma once
#include<stdio.h>
#include<stdlib.h>
typedef char BTDataType;
typedef struct BinaryTreeNode{
BTDataType _data;
struct BinaryTreeNode* lchild;
struct BinaryTreeNode* rchild;
}BTNode;
// ͨǰ"ABD##E#H##CF##G##"
BTNode* BinaryTreeCreate_(BTDataType* a, int* s_n);
BTNode* BinaryTreeCreate(BTDataType* a);
void... |
C | #include <stdio.h>
int main() {
//exercice1
int entier1 = 0;
printf("Entrez un entier : \n", entier1);
scanf("%d", &entier1);
int entier2 = 0;
printf("Entrez un deuxieme entier : \n", entier2);
scanf("%d", &entier2);
if (entier1<entier2)
{
printf ("L'entier le plus grand des... |
C | #include<stdio.h>
void main()
{
int input,i,value,j,fact=1,sum=0;
printf("enter the number for factorial");
printf("\nsum of series type1\n\n");
scanf("%d",&input);
printf("\n\n");
for(i=1;i<=input;i++)
{
value=i;
for(j=1;j<=value;j++)
{
fact=fact*j;
}
sum=sum+fact;
fact=1;
}
printf("Th... |
C | #include "nmqueue.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#define NMQUEUE_INVARIANT(queue)\
assert( queue->queue != NULL );\
assert( queue->readPosition < queue->length );\
assert( queue->writePosition < queue->length );
static const char* errors[] = {
"No Er... |
C | #include <stdio.h>
#include <stdarg.h>
#include <X11/Xlib.h>
#include <X11/extensions/security.h>
int total_error_count = 0; /* total # of errors during entire run */
/* A testset is a group of logically related tests, e.g., all the tests
* for a certain protocol request.
*/
char *testsetname; /* string name of curr... |
C | /*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* Jeroen Domburg <jeroen@spritesmods.com> wrote this file. As long as you retain
* this notice you can do whatever you want with this stuff. If we meet some day,
* and you think this stuff i... |
C | /**
* \file affichage.h
*
* \brief Fichier contenant le code nécessaire à l'affichage graphique (SDL2) du programme
*
* \author JENNY Thibaud
* \version 1.0
* \date 27/03/2020
*
* Dans ce fichier ce trouvent le code des fonctions servant à afficher le programme graphique
*/
#ifndef AFFICHAGE_GRAPHIQUE_H
#define AFFICH... |
C |
// work-stealing deque based on the Chase-Lev paper
#include <stdbool.h>
#include <malloc.h>
#include <glib.h>
#include "chase_lev.h"
circular_array * ca_build(unsigned long int log_size) {
circular_array* ca = (circular_array*) malloc(sizeof(circular_array));
ca->log_size = log_size;
long int real_size = 1... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
void quit(){
//收到信号SIGINT后,结束进程
printf("Process %d received SIGINT,will exit\n",getpid());
exit(0);
}
int main(){
int ret;
if(ret=fork()){
//父进程睡眠秒后向子进程发送信号SIGINT
printf("Parent:%d\n",getpid());
sleep(3);
kil... |
C | #include<stdio.h>
#include<stdlib.h>
struct stack{
int capacity;
int top;
int *array;
};
struct stack* createStack(int capa){
struct stack *newstack=(struct stack*)malloc(sizeof(struct stack));
newstack->top=-1;
newstack->capacity=capa;
newstack->array=(int *)malloc(newstack->capacity*sizeof(int));
return new... |
C | /*
* This file implements elementary operations in finite field GF(2^255-MQ),
* with no inline assembly. The _addcarry_u64() and _subborrow_u64()
* intrinsics are used to get 64-bit additions and subtractions with
* carries; for 64x64->128 multiplications, the 'unsigned __int128' type
* or the _umul128() intrinsic... |
C | // Scott Giorlando
// Assignment 1
// need these include files
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/resource.h>
typedef union {
int exit_status;
struct {
unsigned sig_num: 7;
unsigned core_dmp:... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_float.c :+: :+: :+: ... |
C | #define _XOPEN_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <cs50.h>
#define SALT_LEN 2
#define MAX_PW_LEN 8
#define DICTIONARY_PATH "/usr/share/dict/words"
typedef uint8_t BYTE;
bool compare_PW(char * POTENTIAL_PW, const char * CIP... |
C | /** Agenda
* - Exercise 3 (medium):
* Write a program that counts all letters from a-z (treat a-z and A-Z as same), store their occurrences in an Array and print them out using printf().
**/
#include<stdio.h>
void main() {
int c, i;
int letters[26] = {0}; // init all array values with 0
while( (c = getc... |
C | #include <stdio.h>
#include <stdlib.h>
///bu kodun amac ýtek yollu bir labirentte gidilecek yollarýn koordinatlarýný yazmaktýr.
struct n
{
struct n *next;
int x;
int y;
char eleman;
};
typedef struct n node;
int main()
{
FILE *dosya=fopen("labirent.txt","r");
if(dosya==NULL)
printf("Do... |
C | #include <stdlib.h>
#include "hw1.h"
#include "debug.h"
#include "const.h"
#include "polybius.h"
#include "morse.h"
#ifdef _STRING_H
#error "Do not #include <string.h>. You will get a ZERO."
#endif
#ifdef _STRINGS_H
#error "Do not #include <strings.h>. You will get a ZERO."
#endif
#ifdef _CTYPE_H
#error "Do not #in... |
C | #include <stdio.h>
// program to check whether the character is upper case or not
int main(int argc, char *argv[]) {
char ch;
printf("Enter one character");
scanf("%c",&ch);
if(ch>='A' && ch <=90)
//A=65
printf("Upper case letter");
else
printf("Not Upper case");
return 0;
printf("finish\n", );
}
|
C | /* Andreas Polze 08-jan-05 */
/* mytime.c */
/* Example solution to assignment 4.4.3 */
/* Windows Operating System Internals */
# include <windows.h>
# include <stdio.h>
int main(int argc, char* argv[])
{
S... |
C | /*
** echo.c for 42sh in /home/regisb/Semestre_2/prog_shell/42sh/test
**
** Made by Régis Berthelot
** Login <regis.berthelot@epitech.eu>
**
** Started on Thu May 11 15:51:47 2017 Régis Berthelot
** Last update Sun May 21 11:34:35 2017 Régis Berthelot
*/
#include "42sh.h"
static void muh_putstring(char *str)
{
... |
C | #include <gtk/gtk.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h> /* strlen, strcmp */
#include <ctype.h>
#include<sys/socket.h> //socket
#include<arpa/inet.h> //inet_addr
GtkWidget *resultat;
int sock;
struct sockaddr_in server;
char message[1000] , server_reply[2000],... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
//captura de dados
float base, lado1, lado2;
printf("CLASSIFICACAO DE TRIANGULOS");
printf("\n\nDigite o comprimento da base: ");
scanf("%f", & base);
printf("Digite o comprimento do lado: ");
scanf("%f", & lado1);
printf("Digite o comprimento do ... |
C | #include <stdio.h>
#include <semaphore.h>
#include <sys/shm.h>
#include <fcntl.h>
#include <string.h>
#include <ctype.h>
#include <sys/msg.h>
#include <stdio.h>
#include <semaphore.h>
#include <sys/shm.h>
#include <fcntl.h>
#define NUMERO_PALABRAS 10
#define LONGITUD_MAX 15
#define TAM 200
struct Palabras
{
char p... |
C | #include "kernel_parser.h"
#include <elf.h>
#include <stdbool.h>
#include "screen.h"
#include "utils.h"
bool verify_kernel_elf(Elf64_Ehdr *header);
void load_segments(void *kernel_file, Elf64_Phdr *pheader, unsigned int num_of_pheaders,
boot_info_mem *mmap);
void *load_kernel(boot_info *info) {
... |
C | #include<stdio.h>
int main()
{
int n, x[100002]={0}, s, i, max;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&s);
x[s]++;
}
max = 0;
for(i=0;i<=100000;i++)
{
s=x[i]+x[i+1]+x[i+2];
if(s>max )
{
max = s;
}
}
printf("%d\n", max);
return 0;
} ./Main.c: In function main:
./Main.c:5:1: warning: ignoring ret... |
C | /*
* main.c
*
* Created on: Feb 26, 2015
* Author: skynet
*/
#include <stdio.h>
#include "triunghi.h"
int main(void)
{
unsigned int a, b, c;
int valid;
printf("Dati laturile triunghiului:\n"); //citim laturile triunghiului
printf("a=");
scanf("%d", &a);
printf("b=");
scanf("%d", &b);
printf("c=");
s... |
C | /*---------------------------------------------------------------------------------
Simple effect sound demo
/*\ WARNING effects must be 1st IT file in convertion
all musics must be after IT file
each combination of a music + effect must be lower than 60K
-- alekmaul
----------------------------------... |
C | #include <stdio.h>
int lower_one_mask(int n) {
int size = sizeof(int);
unsigned x = ~0;
x >>= ((size << 3) - n);
return x;
}
int main() {
printf("%.8x\n", lower_one_mask(6));
printf("%.8x\n", lower_one_mask(17));
return 0;
} |
C | #include <pebble.h>
#define HABIT_STRING_MAX_LENGTH 50
#define NUM_OF_HABITS 5
#define MINUTES_BETWEEN_ROTATION 5
#define HABIT1_PERSIST_KEY 0
#define HABIT2_PERSIST_KEY 1
#define HABIT3_PERSIST_KEY 2
#define HABIT4_PERSIST_KEY 3
#define HABIT5_PERSIST_KEY 4
#define PLACEHOLDER_HABIT "Add custom text here using the ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* util.c :+: :+: :+: ... |
C | /* HashManager.c
* Group 6
* Hash Manager
*
* Chris Huang
* Cory Sherman
*/
#include "WebsiteCatalog.h"
#include <string.h>
#include <stdio.h>
static const int DEFAULT_BUCKET_SIZE = 3;
/*******************************************************************************
* HashManager Private Prototy... |
C | /**
* verify.h
*
* Ce fichier contient les prototypes de fonctions vérifiant d'autres fonctions
*
* @author: Dumoulin Peissone S193957
* @date: 21/03/21
* @projet: INFO0030 Projet 2
*/
/*
* Include guard (pour éviter les problèmes d'inclusions multiples
* Bonne pratique: toujours encadrer un header avec un... |
C | /*
* main.c
*
* Created on: Aug 12, 2017
* Author: Mahmoud Ewaisha
*/
#include "string.h"
#include "types.h"
#include "utils.h"
#include "DIO_Interface.h"
#include "DIO.h"
#include "DIO_Config.h"
#include "DELAY.h"
#include "Keypad.h"
#include "LCD.h"
#include "External_Interrupts.h"
#include "Timer.h"
ext... |
C | // Helper functions for music
#include <cs50.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include "helpers.h"
// Converts a fraction formatted as X/Y to eighths
int duration(string fraction)
{
// Numerator
char numStr[1];
numStr[0] = fraction[0];
float num = atoi(n... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main01(void)
{
int a[]={10,7,1,9,4,6,7,3,2,0};
int n;
int i=0;
int j=0;
int tmp=0;
n=sizeof(a)/sizeof(a[0]);//Ԫظ
printf("ǰ\n");
for(i=0;i<n;i++)
{
printf("%d",a[i]);
}
printf("\n");
//ѡ
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(... |
C | #include "FIFO.h"
#include "UART.h"
#include "BrailleConverter.h"
#include "BrailleReaderMain.h"
#include "ZigBee.h"
#include "ST7735.h"
#define STRINGMAX 100
BrailleString waitForString(void) {
char string[STRINGMAX];
int size = UART_InString(string, STRINGMAX);
BrailleString bstring = createBrailleString(string,... |
C | /*
* Autor : Leonardo Maldonado Pagnez
* RA : 172017
*/
#include "montador.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define LOADMQ 0x0A
#define LOADMQMX 0x09
#define STORMX 0x21
#define LOADMX 0x01
#define LOADminusMX 0x02
#define LOADmodMX 0x03
#define JUMPMX 0x0D
#define JUMPM... |
C | #include <stdio.h>
int main(){
int n;
scanf("%d",&n);
long x[n];
int i=0;
int j=0;
int c=0;
long y[n];
int a=0;
int k=0;
int ad=0;
for(i=0;i<n;i++){
scanf("%ld",&x[i]);
}
i=0;
while(c!=-1 && i<n){
j=0;
c=0;
if(i==0){
y[a]=x[i];
a++;
}else{
ad=0;
k=0;
whi... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "sequencial_linear_list.h"
void inicialize_list(List *l){
l->n = 0;
}
int size(List *l){
return l->n;
}
void print_list(List *l){
for(int i=0; i < l->n; i++){
printf("Name:%s | ", l->D[i].name);
printf("Phone:%s | ", l->D[i].phone);
... |
C | #include <stdio.h>
int main(int argc, char *argv[]) {
int i = 5;
int *pi = &i;
printf("i: %d, pi: %p\n", i, pi);
return 0;
}
|
C | #include "headers.h"
void pinfo(char arg[])
{
int id;
if (arg != NULL)
sscanf(arg, "%d", &id);
else
id = getpid();
char pidstat[500];
strcpy(pidstat, "/proc/");
char idchar[500];
sprintf(idchar, "%d", id);
strcat(pidstat, idchar);
char execstat[500];
strcpy(exec... |
C | #ifndef Py_TUPLEOBJECT_H
#define Py_TUPLEOBJECT_H
#include "third_party/python/Include/object.h"
COSMOPOLITAN_C_START_
/* clang-format off */
/*
Another generally useful object type is a tuple of object pointers.
For Python, this is an immutable type. C code can change the tuple items
(but not their number), and even... |
C | //*******************************************************
// R O O M A D V E N T U R E
// adventure.c
// CS 344
// ku3nsting
// May 10, 2017
//*******************************************************
//includes:
#include <stdio.h> //gives us basic file i/o and stuff
#include <stdlib.h> //gives us all standa... |
C | /** Copyright (c) 2011, University of Szeged
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of condition... |
C | /*Purpose:
To declare
1.Functions used.
2.Non-primitive datatypes.
3.Global variable.
Written by:
P.Sai Srujan
III B.Sc-Maths
171207
Written on:
20-03-2020
*/
#include<stdio.h>
#include<stdli... |
C | #include "getopt_client.h"
#include <getopt.h>
#include <errno.h>
#include <sys/types.h>
#include <libgen.h>
#include <stdlib.h>
#include <stdio.h>
ip_port getopt_client(int argc,char **argv)
{
ip_port ip_po_st;
int ip_port;
unsigned short port=0;
char* ... |
C | #include <pebble.h>
#if PBL_IF_ROUND_ELSE(1, 0) == 1
#define PBL_ROUND 1
#else
#define PBL_RECT 1
#endif
#ifdef DBG
#define log(...) APP_LOG(APP_LOG_LEVEL_DEBUG, __VA_ARGS__);
#else
#define log(...) ((void) 0)
#endif
typedef struct {
GPoint origin;
uint8_t radi;
} circle_t;
typedef enum {UP, DOWN, LEFT, RIG... |
C | /*Ponteiros quando a varivel guarda o endereo ao invs do valor da varivel,
muito til para quando necessrio quando implementa um programa que precisa de muitas
funes, porque assim o valor continua salvo quando resgatar o valor em outra funo que invocou a outra.
A engenharia usa programas que so complexos e que prec... |
C | #include<iostream>
using namespace std;
int main()
{
int test;
cin >> test;
while(test--)
{
string str;
cin >> str;
int count=0, ans=1;
for (int i=0; i<str.length()-1; i++)
{
if (str[i]!=str[i+1])
{
ans *= pow(2, count);
... |
C | /*************************************************************
* me06_3.c - Frequency Checker
* programmed by Jaime Broñozo
*
*
**************************************************************/
#include <stdio.h>
int main(void)
{
char string[51], token;
int instance = 0, index;
printf("Input a string: ");
fgets(... |
C | #include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "Interface.h"
#include "argus.h"
/**
* @brief Lê, processa e comunica ao servidor um comando, proveniente de uma shell, a ser executado
*
* @param argc Nº de parametros do comando
*... |
C | /*
* @lc app=leetcode id=100 lang=c
*
* [100] Same Tree
*
* https://leetcode.com/problems/same-tree/description/
*
* algorithms
* Easy (51.66%)
* Likes: 1610
* Dislikes: 49
* Total Accepted: 474.1K
* Total Submissions: 917.5K
* Testcase Example: '[1,2,3]\n[1,2,3]'
*
* Given two binary trees, write... |
C | #include <string.h>
#define MAXLEN 1000 /* max lenght of any input line */
#undef getline
int getLine(char *, int);
char *alloc(int);
/* readlines: read input lines */
int readlines(char *lineptr[], int maxlines)
{
int len, nlines;
char *p, line[MAXLEN];
nlines = 0;
while ((len = getLine(line, MAXLEN)) > 0... |
C | #include "dominion.h"
#include "dominion_helpers.h"
#include "stdio.h"
#include "stdlib.h"
#include "rngs.h"
int testBuyCard();
int main(){
int x = testBuyCard();
if(x == 0){
return 0;
}else{
printf("Error during testBuyCard() testing");
exit(200);
}
}
int testBuyCard(){
... |
C | //Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures
#include <stdio.h>
#include <stdlib.h>
#define NUM_OF_LETTERS 26
#define ASCII_OFFSET_A 65
int hash_char(char c)
{
return (c - ASCII_OFFSET_A)%NUM_OF_LETTERS;
}
int check_unique(c... |
C | struct Node* copyRandomList(struct Node* head)
{
if (head == NULL)
return NULL;
ListNode* oldp = head;
ListNode* newp = NULL;
while (oldp != NULL)
{
newp = (ListNode*)malloc(sizeof(ListNode));
newp->val = oldp->val;
newp->random = NULL;
newp->next = oldp->next;
oldp->next = newp;
oldp = newp->next;
... |
C | /**
* @file tsqueue.h
* @author Liam Powell
* @date 2019-04-25
*
* @brief Thread safe single-producer, multi-consumer FIFO queue.
*
* This is a thread safe single-producer, multi-consumer FIFO queue with the
* following properties:
* - Uses memory provided by the user for the queue itself, allowing the us... |
C | #include <stdlib.h>
#include <string.h>
#include "sortlist.h"
typedef struct _sortlist {
char **args;
int maxarg;
int curarg;
} sortlist;
static sortlist *sl;
#define DEFMAXSL 8
void creatsl(void)
{
sl = malloc(sizeof(sortlist));
sl->args = malloc(DEFMAXSL * sizeof(char *));
sl->maxarg = DEFMAXSL;
sl->curarg... |
C | #pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
/// normalize the path format, converting all '\' to '/' and removing the trailing '/'
void normalize_path( char *path );
/// check if a file/dir exists
int exists( const char *path );
/// check if the given path is a file
int is_file( const ch... |
C | #include <msp432p401r.h>
#include <stdio.h>
#include <stdint.h>
#include <helper.h>
#include <uart.h>
#include <lib_PAE2.h>
// Funcion para que las ruedas puedan girar continuamente
void wheelMode(void){
byte bID = BROADCASTING; // No obtenemos respuesta en este modo
byte bInstruction = WRITE_DATA;
byte b... |
C | #include <curl/curl.h>
#include <json-c/json.h>
#include "global.h"
/* holder for curl fetch */
struct curl_fetch_st {
char *Payload;
size_t Psize;
};
struct curl_fetch_st curl_fetch;
int json_object_count(struct json_object *jobj);
char *URLString(char* u, char* s);
CURLcode curl_fetch_url(CURL *ch, const char *_U... |
C | // 17/12/14 12:33
// Program to solve the problem Perfect Cubes on SPOJ
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define MAX 101
#define int long int
int bs(int*m,int,int,int);
int main(){
int arr[MAX];
int i,a,b,c,d,diff=0;
for(i=0;i<MAX;++i){
arr[i] = i*i*i;
}
for(a=2;a<MAX;++a){
for(b=2;b<... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <sys/time.h>
#include <sys/resource.h>
#define MAX 200000000
void eratosthenes(char prime[], int n);
void eratosthenes(char prime[], int n)
{
memset(prime, 1, n + 1);
prime[0] = prime[1] = 0;
int bound = round(sqrt(n));
... |
C | /*
Given an array nums and a value val, remove all instances of that value in-place and return the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
The order of elements can be changed. It doesn't matter what you leave beyond the... |
C | #pragma once
#include <stdint.h>
struct stack {
uint8_t *elements;
uint32_t count;
uint32_t capacity;
uint32_t elementSize;
};
void stackInitialize(struct stack *stack, uint32_t elementSize);
void stackFree(struct stack *stack);
void *stackGet(struct stack *stack, uint32_t index);
void *stackPop(struct stack *s... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "lists.h"
/**
* list_len - print list elements
*@h: pointer
* Return: r
*/
size_t list_len(const list_t *h)
{
size_t r = 0;
const list_t *temp;
for (temp = h; temp != NULL; temp = temp->next)
{
r++;
}
return (r);
}
|
C | #include<stdio.h>
#define MAX 100001
int stack[MAX],ind=0,maxarr[MAX];
void push(int x)
{
stack[ind]=x;
if(ind==0)
maxarr[0]=stack[0];
else
maxarr[ind]=stack[ind]>maxarr[ind-1]?stack[ind]:maxarr[ind-1];
ind++;
}
void pop()
{
ind--;
}
int main()
{
int n,x,ch;
scanf("%d",&n);
while(n--)
{
scanf("%d",&ch);
... |
C | #ifndef LISTALINEAR
#define LISTALINEAR
#define MAX 10
typedef struct lista
{
int vet[MAX];
int ultimo;
} Lista;
int estaVazia(Lista *l);
void criarLista(Lista *l);
void inserirElemento(Lista *l, int v);
void removerElemento(Lista *l, int i);
void imprimeLista(Lista *l);
#endif |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
struct my_Interval {
int start;
int end;
struct my_Interval* next;
};
typedef struct {
struct my_Interval* head;
} RangeModule;
RangeModule* rangeModuleCreate()
{
RangeModule* obj = malloc(sizeof(RangeModule));
obj->head = NU... |
C | #ifndef PARSERS_C_
#define PARSERS_C_
static inline void ParsePHT2(uint32_t record, int * channel, uint64_t * timetag, uint64_t * oflcorrection);
static inline void ParseHHT2_HH1(uint32_t record, int * channel, uint64_t * timetag, uint64_t * oflcorrection);
static inline void ParseHHT2_HH2(uint32_t record, int * chann... |
C | /*
*@author:lxf
*@time:2017/5/15 14:39
*@title:os实验二第二题
*@subject:设计一个带参数的模块,其参数为某个进程的PID号,
* 该模块的功能是列出改进程的家族信息,包括父进程,
* 兄弟进程和子进程的的程序名、PID号
*@ps:因为带参数,加载模块时要指出参数,如 sudo insmod xfmodule_2.ko pid=xx
*/
#include<linux/init.h>
#include<linux/module.h>
#include<linux/kernel.h>
#include<linux/sched.... |
C | #include<stdio.h>
#include<limits.h>
struct queue
{
unsigned int capacity;
int front,rear,noe,*array;
};
struct queue *makequeue(int capacity)
{
struct queue *q=(struct queue *)malloc(sizeof(struct queue));
q->capacity=capacity;
q->front=0;
q->rear=(capacity-1);
q->noe=0;
q->array=(int ... |
C | /*************************************************************************
> File Name: EP10.c
> Author:
> Mail:
> Created Time: 2019年02月24日 星期日 15时11分07秒
************************************************************************/
#include<stdio.h>
#include<math.h>
#define MAX_N 2000000
int Prime(long int j){
... |
C | /*
makes use of the trampoline technique, and a gcc extension to hold labels in variables
> gcc -g example·trampoline.c
> ./a.out
mallocn succeded
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define address_t_n UINT64_MAX
#define address_t uint64_t
#define continue_via_trampoline ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct cliente {
char nome0[100]; // nome do cliente
char nome1[100]; // telefone do cliente
char nome2[100]; // cpf
char nome3[100]; // nome do produto
char nome4[100]; // codigo do produto
char nome5[100]; // preco do produto... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(void) {
FILE *f;
char ops[3][2] = {"W", "R", "D"};
char *fileops [10][2]; //limit maximum 10 file requests
int x;
int y;
for(x = 0; x < 10; x++){
for(y = 0; y < 2; y++) {
... |
C | /****************************** NAAUTIL3.C ************************************
"Numerical Analysis Algorithms in C" Utilities III v4.2
******************************************************************************/
/*
** This file is very similar to "naautil.c". It contains less frequently
** used dynam... |
C | // usart_tx_task.h
// Jeremiah Griffin <jgrif007@ucr.edu>
// Lab Section: 23
//
// I acknowledge all content contained herein, excluding template or example
// code, is my own original work.
#ifndef CUSTOM_COMMON_USART_TX_TASK_H
#define CUSTOM_COMMON_USART_TX_TASK_H
#include "task.h"
#include "usart.h"
#include <stdd... |
C | //////////////////////////////////////////////////////////////////////////////
// //
// Parentização de produto de Matrizes //
// //
// S... |
C | /*
* stm32f407xx_gpio.c
*
* Created on: May 21, 2019
* Author: dhilan22
*
* GPIO Driver Source File
*/
#include "stm32f407xx_gpio.h"
/************************************************************************
* @fn - GPIO_PeriCLKControl
*
* @brief - This function enables or disables peripheral c... |
C | #include <stdio.h>
float sum(float,float);
int main(){
float varA, varB, res;
puts("Ingrese los valores");
scanf("%f%f", &varA, &varB);
res = sum(varA, varB);
printf("Resultado : %f \n", res);
return 0;
}
float sum(float a, float b){
float res;
res = a+b;
return res;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <math.h>
#include <NestAPI.h>
#define FIG_SEPAR ":"
#define PRIM_SEPAR ""
#define STATE_NEWFIG 0
#define STATE_PRIM 1
void trim(char *str)
{
int i;
for (i = 0; i < strlen(str); i++) {
if (iscntrl(str[i])) ... |
C | #include <stdio.h>
int main(){
int valores[6]; // pos 0 ate a 5
int i;
for(i = 0; i < 6 ; i++){ // 0 ... 5
printf("Digite um valor para a pos %d: ", i);
scanf("%d", &valores[i]);
}
for(i = 5; i >= 0; i--){ // 5 ... 0
printf("[%d] = %d\n", i, valores[i]);
}
return... |
C | /* Ejercicio 1
Una nueva actualización de Tinder permite encontrar el Match perfecto.
Para aquellos que se inscriban a este nuevo feature, sus perfiles serán
categorizados (automáticamente) para luego encontrar un Match perfecto con otra
persona que tenga igual categoría. Hasta ahora se cuenta con un hash que tiene ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <libconfig.h>
#include "config.h"
config_t *config;
/*-------------------------------------------------------------------
* Function : initConfig
* Inputs :
* Outputs : config_t config
*
* This uses the libconfig library to parse a user-modifiable config file.
*... |
C | /**
* @file ghost.c
* @author Lukas Nejezchleb (nejezluk@fel.cvut.cz)
* @brief Module where all the logic and movement of ghost is placed
* @version 0.1
* @date 2021-05-04
*
* @copyright Copyright (c) 2021
*
*/
#include "ghost.h"
#include "data_structures.h"
#include "draw_shapes.h"
#include "ma... |
C | /*************************************************************************
> File Name: ParentPipeChild.c
> Author:yangkun
> Mail:yangkungetit@163.com
> Created Time: Tue 12 Dec 2017 09:22:57 AM CST
************************************************************************/
#include<stdio.h>
#include<unistd.h>
#i... |
C | #include <stdio.h> // Incluyo la libreria
// Prototipos de funciones
void pares(int*);
void impares(int*);
// Funcion principal
int main(void){
int Pares = 0, Impares = 0;
pares(&Pares);
impares(&Impares);
printf("La suma de los pares es %d\n", Pares);
printf("La suma de los impares es %d\n", Impares);
}
// D... |
C | /*
** get_next_line.c for in /home/fritsc_h//progelem
**
** Made by harold fritsch
** Login <fritsc_h@epitech.net>
**
** Started on Mon Nov 19 14:19:17 2012 harold fritsch
** Last update Wed May 1 13:42:18 2013 harold fritsch
*/
#include <stdlib.h>
#include <stdio.h>
#include "get_next_line.h"
char *mkstr(voi... |
C | #include <stdio.h>
int iterativePower(int,int);
int main()
{
int x,n;
printf("enter the number and power:\n");
scanf("%d%d",&x,&n);
printf("%d",iterativePower(x,n));
return 0;
}
int iterativePower(int x,int n)
{
int result=1;
while(n>0)
{
result = result*x;
n--;
}
re... |
C | #include <stdio.h>
int main()
{
int a;
int* ptrtoa;
ptrtoa = &a;
a = 5;
printf("The value of a is %d\n", a);
*ptrtoa = 6;
printf("The value of a is %d\n", a);
printf("The value of ptrtoa is %d\n", ptrtoa);
printf("It stores the value %d\n", *ptrtoa);
printf("The address of a is %d\n", &a);
... |
C | // getPeaks.c
// Written by Ashesh Mahidadia, December 2017
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "DLList.h"
/*
You will submit only this one file.
Implement the function "getPeaks" below. Read the exam paper for
detailed specification and description of your task.
... |
C | /*
* Output compare / PWM
*
* Pulse the onboard LED.
*/
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
void config_timer0(void) {
// With timer clock source freq = 16 MHz / 8,
// our PWM frequency (which is the timer rollover
// frequency) is 2 MHz / 256 = 19.5 KHz
//... |
C | /**
* \file dataservice/dataservice_decode_request_transaction_get_first.c
*
* \brief Decode transaction get first request.
*
* \copyright 2019 Velo Payments, Inc. All rights reserved.
*/
#include <arpa/inet.h>
#include <agentd/status_codes.h>
#include <cbmc/model_assert.h>
#include <string.h>
#include "datase... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct node{
int data;
struct node * next;
}NODE;
typedef NODE * NODEPTR;
NODEPTR newNode(int data) {
NODEPTR temp = (NODEPTR)malloc(sizeof(NODE));
temp -> data = data;
temp -> next = NULL;
return temp;
}
NODEPTR push(NODEPTR head, int data) {
NODEPTR temp =... |
C | #include<stdio.h>
void even(int x)
{
if(x%2==0)
printf("even\n");
else
printf("odd\n");
}
void main()
{
int num;
printf("enter the nummber: ");
scanf("%d",&num);
even(num);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.